def convert_hora hora
  return hora.split(":")
end
#########
# Main  #
#########
begin
  # hora inicial
  puts "Digite a hora inicial do jogo: [hh:mm]"
  h_ini = convert_hora(gets)
  puts "Digite a hora final do jogo: [hh:mm]"
  h_fim = convert_hora(gets)

  h_dur = h_fim[0].to_i - h_ini[0].to_i
  m_dur = h_fim[1].to_i - h_ini[1].to_i

  if m_dur < 0
    m_dur = 60 +m_dur
    h_dur = h_dur - 1
  end

  if h_dur < 0 or (h_dur == 0 and m_dur == 0)
    h_dur = 24 + h_dur
  end
  puts "O jogo durou #{h_dur}h e #{m_dur}min."
rescue Exception => e
  return e
end
